package designmode.share;

import java.util.HashMap;
import java.util.Map;

public class ShareFactory {
    Map<Integer, IFlyWeightElem> map = new HashMap<>();

    public IFlyWeightElem getBall(int num) {
        IFlyWeightElem elem = map.get(num);
        if (elem == null) {
            elem = new FlyWeightElem("第" + num + "大洲");
            map.put(num, elem);
        }
        return elem;
    }
}
